﻿@page
@model DotNetStar.TheKing.Web.Pages.User.Setting.ChangeAvatarModel
@{
    ViewBag.Title = "更换头像";
    Layout = "_Layout";
}

    @if (ModelState.ErrorCount > 0)
    {
        <div asp-validation-summary="All" class="alert alert-danger"></div>
    }
    @if (ViewData["Success"].To<bool>(false))
    {
        <div class="alert alert-success"><i class="fas fa-check-circle"></i> 提交成功</div>
    }
    <form method="post" enctype="multipart/form-data">
        <div class="form-group">
            <div class="row">
                <div class="col-5">
                    <input asp-for="Avatar" class="form-control" />
                    <div class="form-text text-sm text-muted">
                        @Model.Extension.Join("|") 2MB以内
                    </div>
                    <span asp-validation-for="Avatar" class="text-danger"></span>
                </div>
                <div class="col-2">
                    <button type="button" class="btn btn-primary" onclick="$.submit(this)"><i class="fas fa-upload"></i> 开始上传</button>
                </div>
            </div>
        </div>
    </form>
    <div class="form-group">
        <img src="@User.Identity.UserAvatar()" class="img-avatar-200" />
    </div>
